package com.luo.chengrui.module.sa.controller.admin.auth;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;

import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;

import com.luo.chengrui.module.sa.controller.admin.auth.vo.*;
import com.luo.chengrui.module.sa.dal.dataobject.auth.AuthorizeExcludeDO;
import com.luo.chengrui.module.sa.convert.auth.AuthorizeExcludeConvert;
import com.luo.chengrui.module.sa.service.auth.AuthorizeExcludeService;

@Tag(name = "管理后台 - 被排除的角色 ")
@RestController
@RequestMapping("/sa/authorize-exclude")
@Validated
public class AuthorizeExcludeController {

    @Resource
    private AuthorizeExcludeService authorizeExcludeService;

    @PostMapping("/create")
    @Operation(summary = "创建被排除的角色 ")
    @PreAuthorize("@ss.hasPermission('sa:authorize:exclude')")
    public CommonResult<String> createAuthorizeExclude(@Valid @RequestBody AuthorizeExcludeCreateReqVO createReqVO) {
        return success(authorizeExcludeService.createAuthorizeExclude(createReqVO));
    }

    @PostMapping("/cancel")
    @Operation(summary = "取消被排除的角色 ")
    @PreAuthorize("@ss.hasPermission('sa:authorize:exclude')")
    public CommonResult<Boolean> cancelExcludedAuthorize(@Valid @RequestBody AuthorizeExcludeCreateReqVO createReqVO) {
        authorizeExcludeService.cancelExcludedAuthorize(createReqVO);
        return success(true);
    }

}
